﻿<?xml version="1.0" encoding="utf-8" ?>
<AdoNetDataAccess connection="$UserLoginDBConnection$" formatter="bizobjlist of UserGroup(appPrivileges)">
	<Sql>
		SELECT        ug.id, ug.name, ug.description, PrivilegeLevel.id AS appPrivilegesid, PrivilegeLevel.privilegeLevel AS appPrivilegesprivilege
		FROM            UserGroup AS ug INNER JOIN
		UserGroupLink AS ul ON ug.id = ul.groupId LEFT OUTER JOIN
		PrivilegeLevel ON ug.id = PrivilegeLevel.userGroupId
		WHERE        (ul.userId = @userId)
		GROUP BY ug.name, ug.description, ug.id, PrivilegeLevel.privilegeLevel, PrivilegeLevel.id
	</Sql>

	<Param name="userId" type="UniqueIdentifier" />
</AdoNetDataAccess>
